package com.zzx.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.zzx.entity.TGxUser;
import com.zzx.service.TGxUserService;
import com.zzx.entity.ApiResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 控制器
 *
 * @author zzx
 * @since 2025-07-06
 */

@Api(tags = "工序-用户 模块管理")
@RestController
@RequestMapping("/tGxUser")
public class TGxUserController {

    @Resource
    private TGxUserService tGxUserService;

    @ApiOperation(value = "新增、编辑")
    @PostMapping("/add")
    public ApiResult add(@RequestBody TGxUser param) {
        tGxUserService.add(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "列表查询")
    @PostMapping("/selectBy")
    public ApiResult selectBy(@RequestBody TGxUser param) {
        return ApiResult.ok(tGxUserService.selectBy(param));
    }

    @ApiOperation("根据ID获取详情")
    @GetMapping("/{id}")
    public ApiResult getById(@PathVariable("id") String id) {
        return ApiResult.ok(tGxUserService.findById(id));
    }

    @ApiOperation(value = "删除")
    @PostMapping("/deleteById")
    public ApiResult deleteById(@RequestBody TGxUser param) {
        tGxUserService.deleteById(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "批量删除某工序中的多个用户")
    @PostMapping("/deleteBatchGxById")
    public ApiResult deleteBatchGxById(@RequestBody TGxUser param) {
        tGxUserService.deleteBatchGxById(param);
        return ApiResult.ok();
    }
}
